<script language="javascript" type="text/javascript">   
Joomla.submitbutton = function(pressbutton) {
	if (pressbutton == 'cancel') {		
		submitform( pressbutton );	
		return;	
	}

	$('error_area').setStyle('display', 'none');
	if (pressbutton == 'save') {
		var form = document.adminForm;
				
		if (form.name.value == '') {
			$('error_area').setStyle('display', 'block');            
			$('msg').set('text', 'Please input name');
			$('name').addClass('invalid');
			return false;    
		} else {
			$('name').removeClass('invalid');
		}

		if (form.email.value == '' || checkEmail(form.email.value) == false) {        
			$('error_area').setStyle('display', 'block');    
			$('msg').set('text', 'Please input valid email');
			$('email').addClass('invalid');
			return false;    
		} else {
			$('email').removeClass('invalid');
		}
		
		submitform(pressbutton);			
	}	
};   
function checkEmail(email) {
	var atpos = email.indexOf("@");
	var dotpos = email.lastIndexOf(".");
	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length) {
		return false;
	}
	
	return true;
}
</script>

<div id="error_area" style="display:none">
<dl id="system-message">
<dd class="error message">
	<ul><li id="msg"></li></ul>
</dd>
</dl>
</div>

<form action="index.php?option=com_manager" method="post" name="adminForm" enctype="multipart/form-data">	
	<table class="adminform" width="100%">
	    <tr>
	        <td width="10%" >
	        	<label title="" class="hasTip required" for="jform_name" id="jform_name-lbl">Name<span class="star">&nbsp;*</span></label>
	        </td>
	        <td width="40%">
	        	<input type="text" size="30" class="inputbox required" value="<?php echo($this->rows->name); ?>" id="name" name="name">
	        </td>
	        <td width="10%" >
	        	<label title="" class="hasTip required" for="email" id="jform_email-lbl">Email<span class="star">&nbsp;*</span></label>
	        </td>
	        <td width="40%">
	        	<?php if(intval($this->rows->id) != 0){$readonly ='readonly="readonly"';}else{ $readonly='';} ?>				
				<input <?php echo($readonly); ?> type="email" size="30" class="required" value="<?php echo($this->rows->email); ?>" id="email" class="validate-email inputbox" name="email">
	        </td>
		</tr>
		<tr>
	        <td width="10%" >
	        	<label title="" class="hasTip" for="password" id="jform_password-lbl">Password</label>
	        </td>
	        <td width="40%">
	        	<input type="password" size="30" class="inputbox" value="" id="password" name="password">
	        </td>
	        <td width="10%" >
	        	<label title="" class="hasTip" for=password2 id="jform_password2-lbl">Confirm Pass</label>
	        </td>
	        <td width="40%">
	        	<input type="password" size="30" class="inputbox" value="" id="password2" name="password2">
	        </td>
		</tr>
		<tr>
			<td width="10%" >
				<label title="" class="hasTip " for="group_id" id="group_id ">Group</label>
			</td>
			<td width="40%">
				<?php echo($this->lists['group']); ?>
			</td>
		</tr>       	    
   	</table>
   	
	<input type="hidden" name="option" value="com_manager" />
	<input type="hidden" id="id" name="id" value="<?php echo $this->rows->id; ?>" />
	<input type="hidden" id="c" name="c" value="userpim" />
	<input type="hidden" name="task" value="save" />
</form>